<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <script src="http://apps.bdimg.com/libs/angular.js/1.4.6/angular.min.js">
    </script>
</head>

<body>
    <script>
        var app = angular.module('myApp', []);
        // 创建控制器
        app.controller('myCtrl', function ($scope) {
            $scope.firstName = "John";
            $scope.lastName = "Doe";
        });
        // 控制器可以有方法
        app.controller('personCtrl', function ($scope) {
            $scope.firstName = "John";
            $scope.lastName = "Doe";
            $scope.fullName = function () {
                return $scope.firstName + " " + $scope.lastName;
            }
        });
    </script>

    <!-- <script src="personController.js"></script> -->

    <div ng-app="myApp" ng-controller="myCtrl">
        姓：
        <input type="text" ng-model="firstName">
        <br> 名：
        <input type="text" ng-model="lastName">
        <br> 姓名：{{firstName+lastName}}
    </div>
</body>

</html>